﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace helloworld2.MODEL
{
    class VertexContainer
    {

        public int id { get; set; }

        private static VertexContainer instance = null;

        private VertexContainer()
        {
            this.id = 1;
        }

        public static VertexContainer Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new VertexContainer();
                }
                return instance;
            }
        }

        List<Vertex> vertices = new List<Vertex>();

        //public List<Vertex> getVertices()
        //{
        //    var vertexList = new List<Vertex>();
        //    foreach (Vertex v in vertices)
        //    {
        //        vertexList.Add(v);
        //    }
        //    return vertexList;
        //}

        public List<Vertex> getVertices()
        {
            
            return vertices;
        }


        public void addVertex(Vertex newVertex)
        {
            vertices.Add(newVertex);
        }

        public Vertex getVertexByCoordinates(KeyValuePair<int, int> coordinates)
        {
            Vertex v = new Vertex();
            for (int i = 0; i < vertices.Count; i++)
            {
                v = vertices[i];
                if (v.lookForCoordinates(coordinates))
                {
                    i = vertices.Count;
                }
            }
            return v;
        }

    }


}

